/*
 * @Author: 周润玉|zhourunyu1@outlook.com(zhourunyu)
 * @Date: 2022-04-15 13:09:24
 * @LastEditors: ZhouRunYu 2421577210@qq.com
 * @LastEditTime: 2024-03-20 22:03:05
 * @Description:
 * @Administrator: 周润玉|zhourunyu1@outlook.com(zhourunyu)
 * @Copyright: 文件版本号
 */

const MasterDataUrl = Utils.CurDomain.MasterDataUrl;

//域名变量
// const _environmentVariable = (netId, cnId) => {
//     let _version = JSON.parse(Utils.GetSessionStorage('Version'));
//     return _version.SystemEnvironment.indexOf('net') != -1 ? netId : cnId;
// }

const _environmentVariable = (netId, cnId) => {
    return netId;
};

/// 物料单位
const FEEDBACK_TYPE = _environmentVariable(197, 197);
// 发货类型
const shipping_TYPE = _environmentVariable(282, 162);
// 投递状态
const DELIERY_TYPE = _environmentVariable(256, 158);
// 审查类型
const AUDIT_TYPE = _environmentVariable(290, 173);
// 审查整改情况
const RESULT_TYPE = _environmentVariable(291, 174);
// 审查地点
const AUDITADDRESS_TYPE = _environmentVariable(293, 175);
// 审查类别
const AUDIT_CATEGORY = 438;
// 审查厂区类型
const AUDIT_FARM_TYPE = 448;
// 原料库存业务类型
const Material_BUSINESS_TYPE = _environmentVariable(307, 182);
// 销售品类
const LEVEL_TYPE = _environmentVariable(309, 335);
// 畜类鲜活原料
const MATERIAL_TYPE = _environmentVariable(10, 10);
// 死亡处理方式
const DEATH_HANDLING_METOD = _environmentVariable(336, 338);
// 肥猪死亡原因
const FAT_PIG_DEATH_CAUSE = _environmentVariable(95, 41);
// 猪只品种
const PIG_VARIETIES = _environmentVariable(269, 195);
// 猪只盘点类型
const PIGSTOCK_TYPE = _environmentVariable(337, 207);
// 猪只回购品级
const PIGREQURCHASELEVEL_TYPE = _environmentVariable(334, 205);
// 猪只销售等级
const SPECLEVEL_TYPE = _environmentVariable(335, 206);
// 入圈登记 猪只类型
const FOOD_PIG_TYPE = _environmentVariable(366, 345);
// 饲喂记录物料 测试环境 70
const FEEDING_TYPE = 70;
// 物料领用 领用类型
const CONSUMING_TYPE = 390;
// 仓库地点
const INVTRYLOCATION_TYPE = 391;
//养殖销售定价类型
const PIG_FIXEDPRICE_TYPE = 405;
///业务单据状态类型
const BillStatus = _environmentVariable(14, 20);
// 生产安全类别
const PRODSAFE_CATEGORY = 415;
// 屠宰工作站
const SLTRSITE_TYPE = _environmentVariable(294, 164);
// 入厂计划类型
const INBOUNDPLAN_TYPE = 435;
// 入厂计划场所类型
const INBOUNDPLANPLACE_TYPE = 437;
// 运输类型
const CARGO_TYPE = 468;

///导出字典类型
export const DictionaryType = {
    FEEDBACK_TYPE,
    shipping_TYPE,
    DELIERY_TYPE,
    AUDIT_TYPE,
    AUDITADDRESS_TYPE,
    RESULT_TYPE,
    Material_BUSINESS_TYPE,
    LEVEL_TYPE,
    MATERIAL_TYPE,
    DEATH_HANDLING_METOD,
    FAT_PIG_DEATH_CAUSE,
    PIG_VARIETIES,
    PIGSTOCK_TYPE,
    PIGREQURCHASELEVEL_TYPE,
    SPECLEVEL_TYPE,
    FOOD_PIG_TYPE,
    FEEDING_TYPE,
    CONSUMING_TYPE,
    INVTRYLOCATION_TYPE,
    PIG_FIXEDPRICE_TYPE,
    BillStatus,
    PRODSAFE_CATEGORY,
    SLTRSITE_TYPE,
    INBOUNDPLAN_TYPE,
    INBOUNDPLANPLACE_TYPE,
    AUDIT_CATEGORY,
    AUDIT_FARM_TYPE,
    CARGO_TYPE,
};

/**
 * 使用方式
 * 引入 import { DictionaryType,requestDict } from "../../../../public/js/common/dictionary/dictionary-type.js";
 * 请求 requestDict(DictionaryType.AC_TYPE).then(res => console.log(res))
 * 数据字典请求
 * @param {*} id
 */
export const requestDict = async (id) => {
    return $.ajax({
        url: `${MasterDataUrl}/yydictdatacategorys/${id}/dds`,
        beforeSend: Utils.AjaxBeforeSend,
        dataType: 'json',
        type: 'GET',
        error: Utils.AjaxError,
    });
};

/**
 * @summary 获取所有数据字典
 */
export const allDataCategory = async () => {
    return $.ajax({
        url: `${MasterDataUrl}/yydictdatacategorys`,
        beforeSend: Utils.AjaxBeforeSend,
        dataType: 'json',
        type: 'GET',
        error: Utils.AjaxError,
    });
};
